<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <style>
        .el-tabs__item {
            margin-bottom: 30px;
        }

        .el-tabs__active-bar {
            background-color: #E4E7ED;
        }

        .el-dropdown-link {
            cursor: pointer;
            color: #409EFF;
        }

        .el-row {
            margin-bottom: 20px;
        }

        .el-col {
            border-radius: 4px;
        }

        .bg-purple-light {
            background: #e5e9f2;
        }

        .grid-content {
            border-radius: 4px;
            min-height: 36px;
            text-align: center;
            font-size: 16px;
        }

        .row-bg {
            padding: 10px 0;
            background-color: #f9fafc;
        }

    </style>
</head>
<body>
<div id="app">
    <el-container>
        <el-header style="background-color: #0095d7">
            <h1 style="color:white;font-size: 22px">CoolShark商城后台管理系统
            <span style="float: right;font-size: 15px">欢迎{{vipUser.nick}}回来!
                <a href="javascript:void (0)"@click="logout()" style="text-decoration: none">退出登录</a>
            </span>
            </h1>
        </el-header>
        <el-container>
            <el-aside width="200px"style="overflow:visible">
                <!--侧边栏开始-->
                <el-menu
                        class="el-menu-vertical-demo"
                        @select="handleSelect">
                    <el-submenu index="1">
                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span>分类管理</span>
                        </template>
                        <el-menu-item index="1-1">分类列表</el-menu-item>
                    </el-submenu>
                    <el-submenu index="2">
                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span>轮播图管理</span>
                        </template>
                        <el-menu-item index="2-1">轮播图列表</el-menu-item>
                        <el-menu-item index="2-2">添加轮播图</el-menu-item>
                    </el-submenu>

                    <el-submenu index="3">
                        <template slot="title">
                            <i class="el-icon-location"></i>
                            <span>商品管理</span>
                        </template>
                        <el-menu-item index="3-1">添加商品</el-menu-item>
                        <el-menu-item index="3-2">商品列表</el-menu-item>
                    </el-submenu>
                </el-menu>
                <!--侧边栏结束-->
            </el-aside>
            <el-main>
                <!--分类表格开始-->
                <div class="brand_list" v-if="selectedIndex=='1-1'">
                    <el-tabs v-model="activeName" @tab-click="handleClick">
                        <!----------------------------------分类列表展示---------------------------->
                        <el-tab-pane label="分类列表" name="second">
                            <el-row :gutter="20">
                                <el-col :span="2">
                                    <div class="grid-content bg-purple">类别ID</div>
                                </el-col>
                                <el-col :span="6">
                                    <div class="grid-content bg-purple">类别名称</div>
                                </el-col>
                                <el-col :span="6">
                                    <div class="grid-content bg-purple">关键字</div>
                                </el-col>
                                <el-col :span="6">
                                    <div class="grid-content bg-purple">操作</div>
                                </el-col>
                            </el-row>
                            <div v-for="cate in CategroyList">
                                <el-row :gutter="20">
                                    <el-col :span="2">
                                        <div class="grid-content bg-purple">{{cate.categroyId}}</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">{{cate.name}}</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">{{cate.keywords}}</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">
                                            <el-button type="primary" icon="el-icon-edit"
                                                       @click="Categroy(cate.categroyId)"></el-button>
                                            <el-button type="primary" icon="el-icon-delete"
                                                       @click="CategroyDelete(cate.categroyId)"></el-button>
                                        </div>
                                    </el-col>
                                    <el-dialog title="编辑分类" :modal="false"
                                               :visible.sync="dialogFormVisible"

                                    >
                                        <el-form :model="Categroyform">
                                            <el-form-item label="分类ID" :label-width="formLabelWidth">
                                                <el-input v-model=Categroyform.categroyId
                                                          disabled="true"></el-input>
                                            </el-form-item>
                                            <el-form-item label="分类名称" :label-width="formLabelWidth">
                                                <el-input v-model="Categroyform.name" autocomplete="off"></el-input>
                                            </el-form-item>
                                            <el-form-item label="关键字" :label-width="formLabelWidth">
                                                <el-input v-model="Categroyform.keywords"
                                                          autocomplete="off"></el-input>
                                            </el-form-item>

                                        </el-form>
                                        <div slot="footer" class="dialog-footer">
                                            <el-button @click="dialogFormVisible = false">取 消</el-button>
                                            <el-button type="primary" @click="CategroyUpdate()">确 定</el-button>
                                        </div>
                                    </el-dialog>
                                </el-row>

                            </div>
                            <el-form label-width="0px" :model="Categroyform">
                                <el-row :gutter="20">
                                    <el-col :span="3">
                                        <div class="grid-content bg-purple">
                                            <el-form-item>
                                                <el-input placeholder="ID" v-model="Categroyform.categroyId">我的
                                                </el-input>
                                            </el-form-item>
                                        </div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">
                                            <el-form-item>
                                                <el-input placeholder="类别名称" v-model="Categroyform.name">我的
                                                </el-input>
                                            </el-form-item>
                                        </div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">
                                            <el-form-item>
                                                <el-input placeholder="关键字" v-model="Categroyform.keywords">我的
                                                </el-input>
                                            </el-form-item>
                                        </div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">
                                            <el-button type="primary" plain @click="CategroyInsert()">增加类别
                                            </el-button>
                                        </div>
                                    </el-col>
                                </el-row>
                            </el-form>

                        </el-tab-pane>

                        <!----------------------------------系列列表展示---------------------------->
                        <el-tab-pane label="系列列表" name="fourth">
                            <el-row :gutter="20">
                                <el-col :span="2">
                                    <div class="grid-content bg-purple">系列ID</div>
                                </el-col>
                                <el-col :span="6">
                                    <div class="grid-content bg-purple">类别标题</div>
                                </el-col>
                                <el-col :span="6">
                                    <div class="grid-content bg-purple">系列简介</div>
                                </el-col>
                                <el-col :span="6">
                                    <div class="grid-content bg-purple">操作</div>
                                </el-col>
                            </el-row>
                            <div v-for="seri in seriesList">
                                <el-row :gutter="20">
                                    <el-col :span="2">
                                        <div class="grid-content bg-purple">{{seri.seriesId}}</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">{{seri.seriesTitle}}</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">{{seri.seriesIntro}}</div>
                                    </el-col>
                                    <el-col :span="6">
                                        <div class="grid-content bg-purple">
                                            <el-button type="primary" icon="el-icon-edit"
                                                       @click="series(seri.seriesId)"></el-button>
                                            <el-button type="primary" icon="el-icon-delete"
                                                       @click="SeriesDelete(seri.seriesId)"></el-button>
                                        </div>
                                    </el-col>
                                    <el-dialog title="系列列表" :modal="false" :visible.sync="dialogFormVisible">
                                        <el-form :model="seriesform">
                                            <el-form-item label="系列ID" :label-width="formLabelWidth">
                                                <el-input v-model=seriesform.seriesId disabled="true"></el-input>
                                            </el-form-item>
                                            <el-form-item label="系列名称" :label-width="formLabelWidth">
                                                <el-input v-model="seriesform.seriesTitle"
                                                          autocomplete="off"></el-input>
                                            </el-form-item>
                                            <el-form-item label="系列简介" :label-width="formLabelWidth">
                                                <el-input v-model="seriesform.seriesIntro"
                                                          autocomplete="off"></el-input>
                                            </el-form-item>

                                        </el-form>
                                        <div slot="footer" class="dialog-footer">
                                            <el-button @click="dialogFormVisible = false">取 消</el-button>
                                            <el-button type="primary" @click="SeriesUpdate()">确 定</el-button>
                                        </div>
                                    </el-dialog>
                                </el-row>
                            </div>
                        </el-tab-pane>
                        <!----------------------------------系列内容展示---------------------------->
                        <el-tab-pane label="系列内容展示" name="fifth">

                            <el-row :gutter="20">
                                <el-col :span="2">
                                    <div class="grid-content bg-purple">系列ID</div>
                                </el-col>
                                <el-col :span="4">
                                    <div class="grid-content bg-purple">标题</div>
                                </el-col>
                                <el-col :span="5">
                                    <div class="grid-content bg-purple">展示图片</div>
                                </el-col>
                                <el-col :span="5">
                                    <div class="grid-content bg-purple">价格</div>
                                </el-col>
                                <el-col :span="5">
                                    <div class="grid-content bg-purple">操作</div>
                                </el-col>
                            </el-row>
                            <el-form label-width="0px" :model="contentform">
                                <el-row :gutter="20">
                                    <el-col :span="3">
                                        <div class="grid-content bg-purple">
                                            <el-form-item>
                                                <!--      数据库改为自增 删除输入框-->
                                                <el-input placeholder="商品ID" v-model="contentform.spuId">我的
                                                </el-input>
                                            </el-form-item>
                                        </div>
                                    </el-col>
                                    <el-col :span="3">
                                        <div class="grid-content bg-purple">
                                            <el-form-item>
                                                <el-input placeholder="系列ID" v-model="contentform.seriesId">我的
                                                </el-input>
                                            </el-form-item>
                                        </div>
                                    </el-col>
                                    <el-col :span="4">
                                        <div class="grid-content bg-purple">
                                            <el-form-item>
                                                <el-input placeholder="商品标题" v-model="contentform.title">我的
                                                </el-input>
                                            </el-form-item>
                                        </div>
                                    </el-col>
                                    <el-col :span="4">
                                        <div class="grid-content bg-purple">
                                            <el-form-item>
                                                <el-input placeholder="图片地址" v-model="contentform.src">我的
                                                </el-input>
                                            </el-form-item>
                                        </div>
                                    </el-col>
                                    <el-col :span="4">
                                        <div class="grid-content bg-purple">
                                            <el-form-item>
                                                <el-input placeholder="商品价格" v-model="contentform.price">我的
                                                </el-input>
                                            </el-form-item>
                                        </div>
                                    </el-col>



                                    <el-col :span="4">
                                        <div class="grid-content bg-purple">
                                            <el-button type="primary" plain @click="ContentInsert()">增加类别
                                            </el-button>
                                        </div>
                                    </el-col>
                                </el-row>
                            </el-form>
                            <div v-for="seco in contentList">
                                <el-row :gutter="20">
                                    <el-col :span="2">
                                        <div class="grid-content bg-purple">{{seco.seriesId}}</div>
                                    </el-col>
                                    <el-col :span="5">
                                        <div class="grid-content bg-purple">{{seco.title}}</div>
                                    </el-col>
                                    <el-col :span="5">
                                        <div class="grid-content bg-purple">{{seco.src}}</div>
                                    </el-col>
                                    <el-col :span="5">
                                        <div class="grid-content bg-purple">{{seco.price}}</div>
                                    </el-col>
                                    <el-col :span="5">
                                        <div class="grid-content bg-purple">
                                            <el-button type="primary" icon="el-icon-edit"
                                                       @click="content(seco.spuId)"></el-button>
                                            <el-button type="primary" icon="el-icon-delete"
                                                       @click="ContentDelete(seco.spuId)"></el-button>
                                        </div>
                                    </el-col>
                                    <el-dialog title="系列内容展示" :modal="false" :visible.sync="dialogFormVisible">
                                        <el-form :model="contentform">
                                            <el-form-item label="商品ID" :label-width="formLabelWidth">
                                                <el-input v-model=contentform.spuId disabled="true"></el-input>
                                            </el-form-item>
                                            <el-form-item label="系列ID" :label-width="formLabelWidth">
                                                <el-input v-model="contentform.seriesId"
                                                          autocomplete="off"></el-input>
                                            </el-form-item>
                                            <el-form-item label="标题" :label-width="formLabelWidth">
                                                <el-input v-model="contentform.title" autocomplete="off"></el-input>
                                            </el-form-item>
                                            <el-form-item label="图片地址" :label-width="formLabelWidth">
                                                <el-input v-model="contentform.src" autocomplete="off"></el-input>
                                            </el-form-item>
                                            <el-form-item label="价格" :label-width="formLabelWidth">
                                                <el-input v-model="contentform.price" autocomplete="off"></el-input>
                                            </el-form-item>

                                        </el-form>
                                        <div slot="footer" class="dialog-footer">
                                            <el-button @click="dialogFormVisible = false">取 消</el-button>
                                            <el-button type="primary" @click="ContentUpdate()">确 定</el-button>
                                        </div>
                                    </el-dialog>
                                </el-row>
                            </div>

                        </el-tab-pane>

                    </el-tabs>
                </div>
                <!--分类表格结束-->
                <!--轮播图表格开始-->
                <el-table v-if="selectedIndex=='2-1'" :data="bannerArr" style="width: 100%">
                    <!--type="index"设置当前列展示编号信息-->
                    <el-table-column type="index"
                                     label="编号"
                                     width="180">
                    </el-table-column>
                    <el-table-column
                            label="轮播图"
                            width="180">
                        <template slot-scope="scope">
                            <img :src="scope.row.url"width="150" alt="">
                        </template>
                    </el-table-column>
                    <el-table-column label="操作">
                        <!--scope代表的是当前行所包含的数据里面有当前行对应的位置和对象-->
                        <template slot-scope="scope">
                            <el-popconfirm
                                    title="确定删除吗？"
                                    @confirm="bannerDelete(scope.$index, scope.row)"
                            >
                                <el-button
                                        size="mini"
                                        type="danger"
                                        slot="reference">删除</el-button>
                            </el-popconfirm>
                        </template>
                    </el-table-column>
                </el-table>
                <!--轮播图表格结束-->
                <!--添加商品开始-->
                <el-form v-if="selectedIndex=='3-1'" :model="brandArr" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
                    <el-form-item label="商品名称">
                        <el-input v-model="brandArr.title"></el-input>
                    </el-form-item>
                    <el-form-item label="商品最新价格">
                        <el-input v-model="brandArr.price"></el-input>
                    </el-form-item>
                    <el-form-item label="商品旧价格">
                        <el-input v-model="brandArr.oldPrice"></el-input>
                    </el-form-item>
                    <el-form-item label="商品图片">
                        <el-upload
                                action="/upload"
                                name="picFile"
                                list-type="picture-card"
                                :on-preview="handlePictureCardPreview"
                                :on-remove="handleRemove"
                                :on-success="handleSuccess">
                            <i class="el-icon-plus"></i>
                        </el-upload>
                    </el-form-item>
                    <el-dialog :visible.sync="dialogVisible">
                        <img width="100%" :src="dialogImageUrl" alt="">
                    </el-dialog>
                    <el-form-item>
                        <el-button type="primary" @click="submitForm()">立即创建</el-button>
                    </el-form-item>
                </el-form>
                <!--添加商品结束-->
                <!--商品列表开始-->
                <el-table v-if="selectedIndex=='3-2'" :data="tableData" border style="width: 100%">
                    <el-table-column prop="id" label="ID" width="80" align="center"></el-table-column>
                    <el-table-column prop="title" label="商品名称" align="center"></el-table-column>
                    <el-table-column prop="price" label="最新价格" width="150" align="center"></el-table-column>
                    <el-table-column prop="oldPrice" label="旧价格" width="150"  header-align="center"></el-table-column>
                    <el-table-column prop="url" label="图片路径" width="180" align="center"></el-table-column>
                    <el-table-column prop="sort" label="自定义排序序号" width="100" align="center"></el-table-column>
                    <el-table-column label="操作" width="200" align="center">
                        <template slot-scope="scope">
                            <el-button circle icon="el-icon-edit" size="mini" type="text" @click="handleEdit(scope.row.id)"></el-button>
                            <el-button circle icon="el-icon-delete" size="mini" type="danger" @click="openDeleteConfirm(scope.row.id)"></el-button>
                            <!--修改弹出页面-->
                            <el-dialog title="修改商品信息" :visible.sync="dialogFormVisible">
                                <el-form :model="brandArr">
                                    <el-form-item label="商品名称">
                                        <el-input v-model="brandArr.title"></el-input>
                                    </el-form-item>
                                    <el-form-item label="商品最新价格">
                                        <el-input v-model="brandArr.price"></el-input>
                                    </el-form-item>
                                    <el-form-item label="商品旧价格">
                                        <el-input v-model="brandArr.oldPrice"></el-input>
                                    </el-form-item>
                                    <el-form-item label="商品自定义排序序号">
                                        <el-input v-model="brandArr.sort"></el-input>
                                    </el-form-item>
                                    <el-form-item label="商品图片">
                                        <el-upload
                                                action="/upload"
                                                name="picFile"
                                                list-type="picture-card"
                                                :on-preview="handlePictureCardPreview"
                                                :on-remove="handleRemove"
                                                :on-success="handleSuccess">
                                            <i class="el-icon-plus"></i>
                                        </el-upload>
                                    </el-form-item>
                                    <el-dialog :visible.sync="dialogVisible">
                                        <img width="100%" :src="dialogImageUrl" alt="">
                                    </el-dialog>
                                </el-form>
                                <div slot="footer" class="dialog-footer">
                                    <el-button @click="dialogFormVisible = false">取 消</el-button>
                                    <el-button type="primary" @click="Update(v.brandArr)">确 定</el-button>
                                </div>
                            </el-dialog>
                        </template>
                    </el-table-column>
                </el-table>
                <!--商品列表结束-->

            </el-main>
        </el-container>
    </el-container>
</div>


</body>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
   let v = new Vue({
        el: '#app',
        data: function() {
            return {
                selectedIndex:"1-1",
                categoryArr:[],
                bannerArr:[],
                productArr:[],
                vipUser:"",

                dialogImageUrl: '',
                dialogVisible: false,
                brandArr: {
                    id:'',
                    title : '',
                    price : '',
                    oldPrice : '',
                    url : '',
                    sort:''
                },
                rules: {

                },
                tableData:[
                    id='',
                    title='',
                    price='',
                    oldPrice='',
                    url='',
                    sort=''
                ],
                dialogFormVisible: false,



                visible: false,
                tabPosition: 'left',//导航栏靠左排列
                activeName: 'second',
                prices: [],
                activeNames: ['1'],//折叠菜单
                //增加商品分类
                formLabelAlign: {  //默认表单数据
                    name: '',
                    region: '',
                    type: ''
                },


                seriesList: "",//系列列表
                CategroyList: "", // 增加分类弹框
                contentList: "", // 系列内容列表
                // 分类列表数据
                Categroyform: {
                    categroyId: '',
                    name: '',
                    keywords: ''
                },
                seriesform: {
                    seriesId: '',
                    seriesTitle: '',
                    seriesIntro: ''
                },
                contentform: {
                    spuId: '',
                    seriesId: '',
                    Title: '',
                    price:'',
                    src:''
                },

                formLabelWidth: '80px'// 增加分类弹框

            }
        },
       methods:{
            logout(){
                axios.get("logout").then(function () {
                    location.href="/"
                })
            },
           handleSelect(index){
               console.log(index);
             if (index=="2-2"){
                   console.log("添加轮播图");
                   location.href="/insertBanner.html"
               }else  if(index=="3-1"){
                 console.log("添加商品")
                 v.selectedIndex=index;
                 console.log(v.dialogImageUrl)
             }else if(index=="3-2"){
                 console.log("商品列表")
                 v.selectedIndex=index;
                 axios.get("/brands/list").then(function (response) {
                     v.tableData=response.data
                 })
             }else{
                   v.selectedIndex=index;
               }

           },
           categoryDelete(index,category){
            axios.get("/category/delete?id="+category.id).then(function () {
                //删除成功后 删除数据里面的对象 从而让页面跟着改变
                //splice(a,b)数组的删除元素方法,a代表下标b代表数量
                v.categoryArr.splice(index,1)
            })
           },
           productDelete(index,product){
               axios.get("/product/delete?id="+product.id).then(function () {
                   v.productArr.splice(index,1);
               })
           },
           bannerDelete(index,banner){
               //发出删除轮播图的请求
               axios.get("/banner/delete?id="+banner.id).then(function () {
                   //删除成功后 删除数组中的内容让页面跟着改变
                   v.bannerArr.splice(index,1);
               })
       },


           //图片
           handleRemove(file, fileList) {
               console.log(file, fileList);
               //发请求告诉服务器删除文件夹里面的文件
               //得到要删除的文件名
               let fileName= file.response;
               console.log("文件名:"+fileName);
               axios.get("/remove?fileName="+fileName).then(function (response) {
                   console.log("服务器文件删除完成!");
               })
           },
           handlePictureCardPreview(file) {
               let fileName= file.response;
               console.log("文件名:"+fileName);
               this.dialogImageUrl = file.url;
               this.dialogVisible = true;
           },
           handleSuccess(response, file, fileList){
               let fileName= file.response;
               v.brandArr.url=fileName
               console.log("图片路径:"+v.brandArr.url)
           },
           //添加表单
           submitForm() {
               console.log("结果是:"+v.brandArr)
               axios.post("/brands/add-new",v.brandArr).then(function (response) {

               })
               alert("添加成功")
               location.reload()
           },
           //修改列表数据
           handleEdit(id) {
               v.dialogFormVisible = true
               v.brandArr.id=id
               console.log('将编辑id=' + id + "的品牌数据……");
           },
           Update(brand){
               console.log(brand)
               axios.post("/brands/update",v.brandArr).then(function () {
                   console.log(brand)
               })
               alert("修改成功")
               location.reload()
           },
           //删除列表的某一项
           openDeleteConfirm(id) {
               this.$confirm('此操作将永久删除该品牌, 是否继续?', '提示', {
                   confirmButtonText: '确定',
                   cancelButtonText: '取消',
                   type: 'warning'
               }).then(() => {
                   this.handleDelete(id);
               }).catch(() => {
               });
           },
           handleDelete(id) {
               console.log('将删除id=' + id + "的品牌数据……");
               let url = '/brands/' + id + '/delete';
               axios.post(url).then((response) => {
                   location.reload();
                   axios.get("/brands/list").then(function (response) {
                       v.tableData=response.data
                   })
               })
           },




           handleOpen(key, keyPath) {
               console.log(key, keyPath);
           },
           handleClose(key, keyPath) {
               console.log(key, keyPath);
           },
           car(id) {
               console.log("点击的是:" + id)
           },
           handleClick(tab, event) {
               console.log(tab, event);
           },//类别管理 内容导航栏
           Categroy(id) { //修改分类 弹窗
               v.dialogFormVisible = true;
               v.Categroyform.categroyId = id;
               console.log(id)
               // axios.get("/admin/Categroy/updateByid?id=" + id).then(function () {
               // })
           },
           series(id) { //修改分类 弹窗
               v.dialogFormVisible = true;
               v.seriesform.seriesId = id;
               console.log(id)
               // axios.get("/admin/Categroy/updateByid?id=" + id).then(function () {
               // })
           },
           content(id) { //修改分类 弹窗
               v.dialogFormVisible = true;
               v.contentform.spuId = id;
               console.log(id)
               // axios.get("/admin/Categroy/updateByid?id=" + id).then(function () {
               // })
           },
           SeriesUpdate() {
               axios.post("/admin/Categroy/Seriesupdate", v.seriesform).then(function (response) {
                   console.log("seriesform=" + v.seriesform)
                   if (response.data == 1) {
                       alert("修改完成")
                       location.reload()
                   }
               })
               v.dialogFormVisible = false;
           },
           CategroyUpdate() {
               axios.post("/admin/Categroy/update", v.Categroyform).then(function (response) {
                   console.log("categroyForm=" + v.Categroyform)
                   if (response.data == 1) {
                       alert("修改完成")
                       location.reload()
                   }
               })
               v.dialogFormVisible = false;
           },
           ContentUpdate() {
               axios.post("/admin/Categroy/ContentUpdate", v.contentform).then(function (response) {
                   console.log("categroyForm=" + v.contentform)
                   if (response.data == 1) {
                       alert("修改完成")
                       location.reload()
                   }
               })
               v.dialogFormVisible = false;
           },
           CategroyInsert() {
               alert("增加")
               axios.post("/admin/Categroy/addNew", v.Categroyform).then(function () {
                   console.log("categroyForm=")
                   alert("增加成功")
                   location.reload();
               })
           },
           ContentInsert() {
               alert("增加")
               axios.post("/admin/Categroy/contentAddNew", v.contentform).then(function () {
                   console.log("contentform={}",v.contentform)
                   alert("增加成功")
                   location.reload();
               })
           },
           SeriesDelete(id) {
               this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                   confirmButtonText: '确定',
                   cancelButtonText: '取消',
                   type: 'warning',
                   center: true
               }).then(() => {
                   console.log("id=" + id)
                   axios.get("/admin/Categroy/seriesDeleteByid?id=" + id).then(function (response) {
                       console.log("id=" + id)
                       console.log("删除成功")
                       if (response.data == 1) {
                           alert("删除完成")
                           location.reload()
                       } else {
                           alert("出现错误")
                       }
                   })
                   console.log("成功")

               }).catch(() => {

               });
           },
           ContentDelete(id) {
               this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                   confirmButtonText: '确定',
                   cancelButtonText: '取消',
                   type: 'warning',
                   center: true
               }).then(() => {
                   console.log("id=" + id)
                   axios.get("/admin/Categroy/contentDeleteByid?id=" + id).then(function (response) {
                       console.log("id=" + id)
                       console.log("删除成功")
                       if (response.data == 1) {
                           alert("删除完成")
                           location.reload()
                       } else {
                           alert("出现错误")
                       }
                   })
                   console.log("成功")

               }).catch(() => {

               });
           },
           CategroyDelete(id) {
               this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                   confirmButtonText: '确定',
                   cancelButtonText: '取消',
                   type: 'warning',
                   center: true
               }).then(() => {
                   console.log("id=" + id)
                   axios.get("/admin/Categroy/deleteByid?id=" + id).then(function (response) {
                       console.log("id=" + id)
                       console.log("删除成功")
                       if (response.data == 1) {
                           alert("删除完成")
                           location.reload()
                       } else {
                           alert("出现错误")
                       }
                   })
                   console.log("成功")

               }).catch(() => {

               });
           }


       },
       created:function () {
            axios.get("/currentUser").then(function (response) {
                v.vipUser=response.data;
                if (response.data==""){
                    //如果没有登陆则显示登录页面
                    location.href="login.html"
                }
            })
           axios.get("/category/select").then(function (response){
               v.categoryArr = response.data;
           })
           axios.get("/lbt/select").then(function (response) {
               v.bannerArr = response.data;
           })
           axios.get("/product/select").then(function (response) {
               v.productArr =response.data;
           })


           axios.get("/admin/Categroy/list").then(function (response) {
               console.log(response.data)
               v.CategroyList = response.data;
               console.log("bababaababababbaab")
           })
           axios.get("/admin/Categroy/seriesList").then(function (response) {
               console.log(response.data)
               v.seriesList = response.data;
               console.log("aaaaaaa")
           })
           axios.get("/admin/Categroy/contentList").then(function (response) {
               console.log(response.data)
               v.contentList = response.data;
               console.log("aaaaaaa")
           })
       }
    })
</script>
</html>